cmake_minimum_required(VERSION 2.8)
PROJECT(am_tiffer)

#IF(NOT VTK_BINARY_DIR)
#FIND_PACKAGE(VTK)
#IF(NOT VTK_DIR)
#  MESSAGE(FATAL_ERROR "Please set VTK_DIR.")
#ENDIF(NOT VTK_DIR)
#INCLUDE(${VTK_USE_FILE})
#ENDIF(NOT VTK_BINARY_DIR)

FIND_PACKAGE ( ITK REQUIRED)
IF ( ITK_FOUND)
INCLUDE( ${USE_ITK_FILE} )
ENDIF( ITK_FOUND)

#SET(QT_QMAKE_EXECUTABLE ${VTK_QT_QMAKE_EXECUTABLE} CACHE FILEPATH "")
#SET(QT_MOC_EXECUTABLE ${VTK_QT_MOC_EXECUTABLE} CACHE FILEPATH "")
#SET(QT_UIC_EXECUTABLE ${VTK_QT_UIC_EXECUTABLE} CACHE FILEPATH "")
SET(QT_QMAKE_EXECUTABLE "C:/Qt64/4.8.1/bin/qmake.exe")
SET(QT_MOC_EXECUTABLE "C:/Qt64/4.8.1/bin/moc.exe")
SET(QT_UIC_EXECUTABLE "C:/Qt64/4.8.1/bin/uic.exe")

FIND_PACKAGE(Qt4 REQUIRED)
INCLUDE(${QT_USE_FILE})
# Set your files and resources here
SET(Main main.cpp mainwindow.cpp am.cpp tiff.cpp network.h)
SET(MainUI mainwindow.ui)
SET(MainH mainwindow.h)
INCLUDE_DIRECTORIES(
  ${QT_INCLUDE_DIR}
  ${CMAKE_CURRENT_BINARY_DIR}
  ${CMAKE_CURRENT_SOURCE_DIR}
)
QT4_WRAP_UI(UISrcs ${MainUI})
QT4_WRAP_CPP(MOCSrcs ${MainH} )
SOURCE_GROUP("Resources" FILES
  ${MainUI}
)
SOURCE_GROUP("Generated" FILES
  ${UISrcs}
  ${MOCSrcs}
  ${RCS_SOURCES}
)

set(PROJECTNAME "am_tiffer")
set(BIN_DIR "../../bin")

add_definitions(-D_CRT_SECURE_NO_WARNINGS)
ADD_EXECUTABLE( ${PROJECTNAME} ${Main} ${UISrcs} ${MOCSrcs})
#TARGET_LINK_LIBRARIES( main QVTK ${ITK_LIBRARIES}  )
TARGET_LINK_LIBRARIES( ${PROJECTNAME} ${ITK_LIBRARIES} ${QT_LIBRARIES} )

ADD_CUSTOM_COMMAND(TARGET ${PROJECTNAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${PROJECTNAME}.exe ${BIN_DIR}/.)
